<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <form action="">
        <label for="stu_id">学号：<input type="text" id="stu_id"></label><br>
        <label for="stu_name">姓名：<input type="text" id="stu_name"></label><br>
        <label for="stu_sex">性别：<input type="text" id="stu_sex"></label><br>
        <label for="stu_jg">籍贯：<input type="text" id="stu_jg"></label><br>
        <label for="stu_date">出生日期：<input type="text" id="stu_date"></label><br>
        <label for="stu_hobby">爱好：<input type="text" id="stu_hobby"></label><br>
        <label for="stu_gbf">男或女朋友：<input type="text" id="stu_gbf"></label><br>
        <label for="stu_head_img">头像：<input type="file" id="stu_head_img"></label><br>
        <button class="btn">提交信息</button>
    </form>
    <script src="../jquery/jquery-1.12.4.min.js"></script>
    <script>
        $(".btn").click((e)=>{
            e.preventDefault;
            $.ajax({
                method:"post",
                url:"http://localhost:3000/student_info",
                data:{
                    stu_id:$("#stu_id").val(),
                    stu_name:$("#stu_name").val(),
                    stu_sex:$("#stu_sex").val(),
                    stu_jg:$("#stu_jg").val(),
                    stu_date:$("#stu_date").val(),
                    stu_hobby:$("#stu_hobby").val(),
                    stu_gbf:$("#stu_gbf").val(),
                    stu_head_img:$("#stu_head_img").val()
                },
                success:(data)=>{
                    console.log(data);
                },
                error:(err)=>{
                    console.log(err);
                }
            })
        })
    </script>
</body>
</html>